Creating a page redirect using a Content Picker [SOLVED]
Ok so here is the situation, I have a menu that is populated by sub nodes of a node. What I want to do is have more items in this menu that point to the same page for example say I have the following pages:
Cats
Dogs
Horses
I want to be able to add another item to my menu called "Felines" that points to the same page as "Cats". I would of course have to create another page called "Felines" that would redirect to my Cats page. So far I have created another Document Type called "Redirect" that contains a Content Picker, I can therefore create a new redirect page and select the "Cats" page using my content picker. The bit I am now struggling on is what to put in the template for my "Redirect" page to make it redirect to whatever is selected in the "Content Picker". I tried adding the following to my "Redirect" page template but of course the asp.net code does not recognise the Umbraco call to get the item field "Redirect", can anyone point me in the right direction?? Cheers
Add an extra property to your doc type of 'Cats', 'Dogs' and 'Horses' (alias must be umbracoUrlName). Add another item 'Felines' and enter the 'Cats' (without the quotes) for the new property. It will change the url for that specific node to the same url for 'Cats'.
Node name will not change...
Thanks for this, I have just tested it and it works as you said, I just wondered if there was anyway that I could use the Content Picker instead of having to type in the name of the page I want it to link to? It's just that I know that typing a name correctly can sometimes be a problem for a user! I did try to make the umbracoUrlName field a "Content Picker" but it of course then returns the node ID rather than the name.
It might be possible, but you'll have to adapt the xslt for listing the menu... Check whether the content picker property has a value, and if so, use that value and NiceUrl() to create a link to that other node.
You could also create a property on your document type with a content picker, and give it the alias umbracoRedirect.
Now create your Felines page, and select the Cats page with the content picker, and it will automagically redirect you when you visit the Felines page.
You will then have a site like this
Content
- Home
-- Cats
-- Dogs
-- Horses
-- Felines (Cats page selected in umbracoRedirect property)
This way you would not have to change your menu macro.
Excellent that is exactly what I needed, thank you both for all your help. Is some sort of list somewhere with all these Umbraco commands etc so that I don't have to keep bothering you guys in future?
I'm sure I read a post the other day from someone a while back who was claiming that they were going to create an umbraco knowlegebase website, I assume nothing come of it? It would be handy to have a list somewhere with all the different Umbraco functions including so XSLT commands that are useful.
Creating a page redirect using a Content Picker [SOLVED]
Ok so here is the situation, I have a menu that is populated by sub nodes of a node. What I want to do is have more items in this menu that point to the same page for example say I have the following pages:
[/code]Cats
Dogs
Horses
I want to be able to add another item to my menu called "Felines" that points to the same page as "Cats". I would of course have to create another page called "Felines" that would redirect to my Cats page. So far I have created another Document Type called "Redirect" that contains a Content Picker, I can therefore create a new redirect page and select the "Cats" page using my content picker. The bit I am now struggling on is what to put in the template for my "Redirect" page to make it redirect to whatever is selected in the "Content Picker". I tried adding the following to my "Redirect" page template but of course the asp.net code does not recognise the Umbraco call to get the item field "Redirect", can anyone point me in the right direction?? Cheers
[code]
Hi,
Add an extra property to your doc type of 'Cats', 'Dogs' and 'Horses' (alias must be umbracoUrlName). Add another item 'Felines' and enter the 'Cats' (without the quotes) for the new property. It will change the url for that specific node to the same url for 'Cats'.
Node name will not change...
Regards,
/Dirk
Hi Dirk,
Thanks for this, I have just tested it and it works as you said, I just wondered if there was anyway that I could use the Content Picker instead of having to type in the name of the page I want it to link to? It's just that I know that typing a name correctly can sometimes be a problem for a user! I did try to make the umbracoUrlName field a "Content Picker" but it of course then returns the node ID rather than the name.
Hi,
It might be possible, but you'll have to adapt the xslt for listing the menu... Check whether the content picker property has a value, and if so, use that value and NiceUrl() to create a link to that other node.
[code][/code]
Hope this helps.
Regards,
/Dirk
You could also create a property on your document type with a content picker, and give it the alias umbracoRedirect.
Now create your Felines page, and select the Cats page with the content picker, and it will automagically redirect you when you visit the Felines page.
You will then have a site like this
Content
- Home
-- Cats
-- Dogs
-- Horses
-- Felines (Cats page selected in umbracoRedirect property)
This way you would not have to change your menu macro.
Yep, indeed, forgot about that, thanks for backing me up Morten,
Cheers,
/Dirk
Excellent that is exactly what I needed, thank you both for all your help. Is some sort of list somewhere with all these Umbraco commands etc so that I don't have to keep bothering you guys in future?
Hmm, not really, but it would be great idea to gather all those... I might get a list here for future reference...
Cheers,
/Dirk
I'm sure I read a post the other day from someone a while back who was claiming that they were going to create an umbraco knowlegebase website, I assume nothing come of it? It would be handy to have a list somewhere with all the different Umbraco functions including so XSLT commands that are useful.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.